inspector: Make translatable
authorMatthias Clasen <mclasen@redhat.com>
Wed, 7 May 2014 04:13:00 +0000 (00:13 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 11 May 2014 02:04:20 +0000 (22:04 -0400)
Mark strings in the source and in the templates as translatable.
We use the same extract-strings utility as for libgtk itself.

14 files changed:
modules/inspector/Makefile.am
modules/inspector/button-path.ui
modules/inspector/classes-list.c
modules/inspector/classes-list.ui
modules/inspector/css-editor.c
modules/inspector/css-editor.ui
modules/inspector/inspect-button.c
modules/inspector/object-hierarchy.ui
modules/inspector/prop-list.ui
modules/inspector/themes.ui
modules/inspector/widget-tree.ui
modules/inspector/window.c
modules/inspector/window.ui
po/POTFILES.in

index 97dcd3273a2a7fd31a2cf6b20e5a491ac73c3746..6cc8f60a2890dfdf5bdc57211330e0091cce8185 100644 (file)
@@ -6,7 +6,7 @@ resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --gener
 resources.h: inspector.gresource.xml
        $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/inspector.gresource.xml \
                --target=$@ --sourcedir=$(srcdir) --c-name gtk_inspector --generate-header --manual-register
-resources.c: inspector.gresource.xml $(resource_files)
+resources.c: inspector.gresource.xml $(resource_files) $(template_headers)
        $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/inspector.gresource.xml \
                --target=$@ --sourcedir=$(srcdir) --c-name gtk_inspector --generate-source --manual-register
 
@@ -63,7 +63,29 @@ libgtkinspector_la_LIBADD = \
        $(top_builddir)/gtk/libgtk-3.la \
        $(GTK_DEP_LIBS)
 
-EXTRA_DIST= \
+templates = \ 
+       button-path.ui \
+       classes-list.ui \
+       css-editor.ui \
+       object-hierarchy.ui \
+       prop-list.ui \
+       themes.ui \
+       widget-tree.ui \
+       window.ui
+
+template_headers = $(templates:.ui=.ui.h)
+
+extract_strings = $(top_builddir)/gtk/extract-strings$(BUILD_EXEEXT)
+
+%.ui.h: %.ui $(extract_strings)
+       $(AM_V_GEN) $(extract_strings) $< > $@
+
+distclean-local:
+       if test $(srcdir) != .; then \
+         rm -f $(template_headers); \
+       fi
+
+EXTRA_DIST=
        $(resource_files)
 
 -include $(top_srcdir)/git.mk
index e4addfbe9bd5e0897218c05aac437d12b425cdb9..b586f4198c3e7ab55dba4103510feb47d454193f 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<interface>
+<interface domain="gtk30">
   <template class="GtkInspectorButtonPath" parent="GtkBox">
     <property name="orientation">horizontal</property>
     <child>
@@ -22,7 +22,7 @@
             <child>
               <object class="GtkLabel">
                 <property name="visible">True</property>
-                <property name="label">Choose a widget through the inspector</property>
+                <property name="label" translatable="yes">Choose a widget through the inspector</property>
                 <property name="hexpand">True</property>
                 <property name="xalign">0.5</property>
               </object>
index 86d078e417281799e7c3ae09a0d52364daba1701..7c0d52a7444da7484c5e05698dd8e5aa4a97ea5b 100644 (file)
@@ -20,6 +20,8 @@
  * THE SOFTWARE.
  */
 
+#include "config.h"
+#include <glib/gi18n-lib.h>
 #include "classes-list.h"
 
 enum
@@ -99,18 +101,18 @@ add_clicked (GtkButton               *button,
 {
   GtkWidget *dialog, *content_area, *entry;
 
-  dialog = gtk_dialog_new_with_buttons ("New class",
+  dialog = gtk_dialog_new_with_buttons (_("New class"),
                                         GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (cl))),
                                          GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_USE_HEADER_BAR,
-                                         "_OK", GTK_RESPONSE_OK,
-                                         "Cancel", GTK_RESPONSE_CANCEL,
+                                         _("_OK"), GTK_RESPONSE_OK,
+                                         _("Cancel"), GTK_RESPONSE_CANCEL,
                                          NULL);
   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
 
   entry = g_object_new (GTK_TYPE_ENTRY,
                         "visible", TRUE,
                         "margin", 5,
-                        "placeholder-text", "Class name",
+                        "placeholder-text", _("Class name"),
                         "activates-default", TRUE,
                         NULL);
   content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
index 363b1ead380769e93f6db0cf4659a0fdd985896f..b7198a3b8fb58a5e4e50199f688104b1868777d0 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<interface>
+<interface domain="gtk30">
   <object class="GtkListStore" id="model">
     <columns>
       <column type="gboolean"/>
@@ -18,7 +18,7 @@
           <object class="GtkToolButton">
             <property name="visible">True</property>
             <property name="icon-name">list-add</property>
-            <property name="tooltip-text">Add a class</property>
+            <property name="tooltip-text" translatable="yes">Add a class</property>
             <signal name="clicked" handler="add_clicked"/>
           </object>
         </child>
@@ -26,7 +26,7 @@
           <object class="GtkToolButton">
             <property name="visible">True</property>
             <property name="icon-name">document-revert</property>
-            <property name="tooltip-text">Restore defaults for this widget</property>
+            <property name="tooltip-text" translatable="yes">Restore defaults for this widget</property>
             <signal name="clicked" handler="restore_defaults_clicked"/>
           </object>
         </child>
@@ -42,7 +42,7 @@
             <property name="model">model</property>
             <child>
               <object class="GtkTreeViewColumn" id="column">
-                <property name="title">Name</property>
+                <property name="title" translatable="yes">Name</property>
                 <child>
                   <object class="GtkCellRendererToggle">
                     <signal name="toggled" handler="enabled_toggled"/>
index e7f6a8c8dee6bbd17ec88a5b06cd03261557c307..1d49146e1da3a7ed080c4e0685cd0421c00ee889 100644 (file)
@@ -20,6 +20,8 @@
  * THE SOFTWARE.
  */
 
+#include "config.h"
+#include <glib/gi18n-lib.h>
 #include "css-editor.h"
 
 #define GTK_INSPECTOR_CSS_EDITOR_TEXT "inspector-css-editor-text"
@@ -60,28 +62,30 @@ G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorCssEditor, gtk_inspector_css_editor, GTK
 static void
 set_initial_text (GtkInspectorCssEditor *editor)
 {
-  const gchar *initial_text_global =
-    "/*\n"
-    "You can type here any CSS rule recognized by GTK+.\n"
-    "You can temporarily disable this custom CSS by clicking on the \"Pause\" button above.\n\n"
-    "Changes are applied instantly and globally, for the whole application.\n"
-    "*/\n\n";
-  const gchar *initial_text_widget =
-    "/*\n"
-    "You can type here any CSS rule recognized by GTK+.\n"
-    "You can temporarily disable this custom CSS by clicking on the \"Pause\" button above.\n\n"
-    "Changes are applied instantly, only for this selected widget.\n"
-    "*/\n\n";
   const gchar *text = NULL;
 
   if (editor->priv->selected_context)
     text = g_object_get_data (G_OBJECT (editor->priv->selected_context), GTK_INSPECTOR_CSS_EDITOR_TEXT);
   if (text)
     gtk_text_buffer_set_text (GTK_TEXT_BUFFER (editor->priv->text), text, -1);
-  else if (editor->priv->global)
-    gtk_text_buffer_set_text (GTK_TEXT_BUFFER (editor->priv->text), initial_text_global, -1);
   else
-    gtk_text_buffer_set_text (GTK_TEXT_BUFFER (editor->priv->text), initial_text_widget, -1);
+    {
+      gchar *initial_text;
+      if (editor->priv->global)
+        initial_text = g_strconcat ("/*\n",
+                                    _("You can type here any CSS rule recognized by GTK+."), "\n",
+                                    _("You can temporarily disable this custom CSS by clicking on the \"Pause\" button above."), "\n\n",
+                                    _("Changes are applied instantly and globally, for the whole application."), "\n",
+                                    "*/\n\n", NULL);
+      else
+        initial_text = g_strconcat ("/*\n",
+                                    _("You can type here any CSS rule recognized by GTK+."), "\n",
+                                    _("You can temporarily disable this custom CSS by clicking on the \"Pause\" button above."), "\n\n",
+                                    _("Changes are applied instantly, only for this selected widget."), "\n",
+                                    "*/\n\n", NULL);
+      gtk_text_buffer_set_text (GTK_TEXT_BUFFER (editor->priv->text), initial_text, -1);
+      g_free (initial_text);
+    }
 }
 
 static void
index 7987d8a6c2b567867477e99df748da67841e4c22..7a6d921a25902d074bf9cd303e14bec7df8d7016 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<interface>
+<interface domain="gtk30">
   <object class="GtkTextTagTable" id="tags">
     <child type="tag">
       <object class="GtkTextTag">
@@ -26,7 +26,7 @@
           <object class="GtkToggleToolButton" id="disable_button">
             <property name="visible">True</property>
             <property name="icon-name">media-playback-pause</property>
-            <property name="tooltip-text">Disable this custom CSS</property>
+            <property name="tooltip-text" translatable="yes">Disable this custom CSS</property>
             <signal name="toggled" handler="disable_toggled"/>
           </object>
         </child>
index 6c6fbb5f0816150e3287a324e5700091de491fd2..a7ea24cbbf3f162fd8894a10bf30d8dbcec0f3d3 100644 (file)
@@ -21,6 +21,8 @@
  * THE SOFTWARE.
  */
 
+#include "config.h"
+#include <glib/gi18n-lib.h>
 #include "window.h"
 #include "widget-tree.h"
 
@@ -296,7 +298,7 @@ gtk_inspector_inspect_button_new (GtkInspectorWindow *iw)
   GtkWidget *button;
 
   button = gtk_button_new_from_icon_name ("edit-find", GTK_ICON_SIZE_BUTTON);
-  gtk_widget_set_tooltip_text (button, "Inspect");
+  gtk_widget_set_tooltip_text (button, _("Inspect"));
   g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (on_inspect), iw);
 
   return button;
index 04d54e18e8224990e83c95910ae4efced4005121..fd5dd0b91eb4a82dde0d96e60f5e874c204d260e 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<interface>
+<interface domain="gtk30">
   <object class="GtkTreeStore" id="model">
     <columns>
       <column type="gchararray"/>
@@ -17,7 +17,7 @@
             <property name="model">model</property>
             <child>
               <object class="GtkTreeViewColumn">
-                <property name="title">Object Hierarchy</property>
+                <property name="title" translatable="yes">Object Hierarchy</property>
                 <child>
                   <object class="GtkCellRendererText">
                     <property name="scale">0.8</property>
index a3064ac0ed5a49a96ba6ba7f947a795318729591..ed920094a44c76dadb6630c9b0cb5f95b5b1c210 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<interface>
+<interface domain="gtk30">
   <object class="GtkListStore" id="model">
     <columns>
       <column type="gchararray"/>
@@ -15,7 +15,7 @@
     <property name="tooltip-column">4</property>
     <child>
       <object class="GtkTreeViewColumn">
-        <property name="title">Property</property>
+        <property name="title" translatable="yes">Property</property>
         <property name="resizable">True</property>
         <property name="sort-order">ascending</property>
         <property name="sort-column-id">0</property>
@@ -32,7 +32,7 @@
     </child>
     <child>
       <object class="GtkTreeViewColumn">
-        <property name="title">Value</property>
+        <property name="title" translatable="yes">Value</property>
         <property name="resizable">True</property>
         <child>
           <object class="GtkInspectorPropertyCellRenderer" id="value_renderer">
@@ -50,7 +50,7 @@
     </child>
     <child>
       <object class="GtkTreeViewColumn">
-        <property name="title">Defined At</property>
+        <property name="title" translatable="yes">Defined At</property>
         <child>
           <object class="GtkCellRendererText">
             <property name="scale">0.8</property>
index 1e94264ddff8c6608134fede3cbc4c8c650dcc46..73ca432a4623ba1fef6c2bded6d69ba4cb6d4e23 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<interface>
+<interface domain="gtk30">
   <template class="GtkInspectorThemes" parent="GtkListBox">
     <property name="selection-mode">none</property>
     <child>
@@ -10,7 +10,7 @@
         <child>
           <object class="GtkLabel">
             <property name="visible">True</property>
-            <property name="label">Use dark variant</property>
+            <property name="label" translatable="yes">Use dark variant</property>
             <property name="hexpand">True</property>
             <property name="xalign">0.0</property>
           </object>
@@ -30,7 +30,7 @@
         <child>
           <object class="GtkLabel">
             <property name="visible">True</property>
-            <property name="label">GTK+ Theme</property>
+            <property name="label" translatable="yes">GTK+ Theme</property>
             <property name="hexpand">True</property>
             <property name="xalign">0.0</property>
           </object>
@@ -51,7 +51,7 @@
         <child>
           <object class="GtkLabel">
             <property name="visible">True</property>
-            <property name="label">Icon Theme</property>
+            <property name="label" translatable="yes">Icon Theme</property>
             <property name="hexpand">True</property>
             <property name="xalign">0.0</property>
           </object>
index 9a53d5facc352243c8e8af9225769b1aa0fea62d..1b01f72a3279f0daccecedd4f103f8ffe03e9f40 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<interface>
+<interface domain="gtk30">
   <object class="GtkTreeStore" id="model">
     <columns>
       <column type="gpointer"/>
@@ -23,7 +23,7 @@
     </child>
     <child>
       <object class="GtkTreeViewColumn">
-        <property name="title">Widget</property>
+        <property name="title" translatable="yes">Widget</property>
         <property name="resizable">True</property>
         <child>
           <object class="GtkCellRendererText">
@@ -38,7 +38,7 @@
     </child>
     <child>
       <object class="GtkTreeViewColumn">
-        <property name="title">Name</property>
+        <property name="title" translatable="yes">Name</property>
         <property name="resizable">True</property>
         <child>
           <object class="GtkCellRendererText">
@@ -53,7 +53,7 @@
     </child>
     <child>
       <object class="GtkTreeViewColumn">
-        <property name="title">Realized</property>
+        <property name="title" translatable="yes">Realized</property>
         <child>
           <object class="GtkCellRendererToggle">
             <property name="activatable">True</property>
@@ -67,7 +67,7 @@
     </child>
     <child>
       <object class="GtkTreeViewColumn">
-        <property name="title">Mapped</property>
+        <property name="title" translatable="yes">Mapped</property>
         <child>
           <object class="GtkCellRendererToggle">
             <property name="activatable">True</property>
@@ -81,7 +81,7 @@
     </child>
     <child>
       <object class="GtkTreeViewColumn">
-        <property name="title">Visible</property>
+        <property name="title" translatable="yes">Visible</property>
         <child>
           <object class="GtkCellRendererToggle">
             <property name="activatable">True</property>
@@ -95,7 +95,7 @@
     </child>
     <child>
       <object class="GtkTreeViewColumn">
-        <property name="title">Address</property>
+        <property name="title" translatable="yes">Address</property>
         <property name="resizable">True</property>
         <child>
           <object class="GtkCellRendererText">
index 4383e483600d7faf1c21e5e473233f2d7f980ad1..db420befe8b12e0db4195c4356b537a3f0aad538 100644 (file)
@@ -22,6 +22,8 @@
  * THE SOFTWARE.
  */
 
+#include "config.h"
+#include <glib/gi18n-lib.h>
 #include <stdlib.h>
 #include "window.h"
 #include "prop-list.h"
@@ -119,7 +121,7 @@ gtk_inspector_window_init (GtkInspectorWindow *iw)
 
   gtk_window_group_add_window (gtk_window_group_new (), GTK_WINDOW (iw));
 
-  title = g_strdup_printf ("GTK+ Inspector — %s", g_get_application_name ());
+  title = g_strdup_printf (_("GTK+ Inspector — %s"), g_get_application_name ());
   gtk_window_set_title (GTK_WINDOW (iw), title);
   g_free (title);
 
index a1d7a45c495b8f8a9288ca0a70e7f60df1b50e0b..287628f0538f8bd8791099c9e32c904048341eae 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<interface>
+<interface domain="gtk30">
   <object class="GtkImage" id="update_image">
     <property name="visible">True</property>
     <property name="icon-name">view-refresh</property>
@@ -15,7 +15,7 @@
     <child>
       <object class="GtkMenuItem">
         <property name="visible">True</property>
-        <property name="label">Send Widget to Shell</property>
+        <property name="label" translatable="yes">Send Widget to Shell</property>
         <signal name="activate" handler="on_send_widget_to_shell_activate"/>
       </object>
     </child>
@@ -37,7 +37,7 @@
               <object class="GtkButton">
                 <property name="visible">True</property>
                 <property name="image">inspect_image</property>
-                <property name="tooltip-text">Inspect</property>
+                <property name="tooltip-text" translatable="yes">Inspect</property>
                 <signal name="clicked" handler="on_inspect"/>
               </object>
             </child>
@@ -45,7 +45,7 @@
               <object class="GtkToggleButton">
                 <property name="visible">True</property>
                 <property name="image">update_image</property>
-                <property name="tooltip-text">Show Graphic Updates</property>
+                <property name="tooltip-text" translatable="yes">Show Graphic Updates</property>
                 <signal name="toggled" handler="on_graphic_updates_toggled"/>
               </object>
             </child>
                     <child type="tab">
                       <object class="GtkLabel">
                         <property name="visible">True</property>
-                        <property name="label">Properties</property>
+                        <property name="label" translatable="yes">Properties</property>
                       </object>
                     </child> 
                     <child>
                     <child type="tab">
                       <object class="GtkLabel">
                         <property name="visible">True</property>
-                        <property name="label">Child Properties</property>
+                        <property name="label" translatable="yes">Child Properties</property>
                       </object>
                     </child> 
                     <child>
                     <child type="tab">
                       <object class="GtkLabel">
                         <property name="visible">True</property>
-                        <property name="label">Hierarchy</property>
+                        <property name="label" translatable="yes">Hierarchy</property>
                       </object>
                     </child> 
                     <child>
                     <child type="tab">
                       <object class="GtkLabel">
                         <property name="visible">True</property>
-                        <property name="label">CSS Classes</property>
+                        <property name="label" translatable="yes">CSS Classes</property>
                       </object>
                     </child> 
                     <child>
                     <child type="tab">
                       <object class="GtkLabel">
                         <property name="visible">True</property>
-                        <property name="label">Custom CSS</property>
+                        <property name="label" translatable="yes">Custom CSS</property>
                       </object>
                     </child> 
                   </object>
         <child type="tab">
           <object class="GtkLabel">
             <property name="visible">True</property>
-            <property name="label">Widget Tree</property>
+            <property name="label" translatable="yes">Widget Tree</property>
           </object>
         </child>
         <child>
         <child type="tab">
           <object class="GtkLabel">
             <property name="visible">True</property>
-            <property name="label">Themes</property>
+            <property name="label" translatable="yes">Themes</property>
           </object>
         </child>
         <child>
         <child type="tab">
           <object class="GtkLabel">
             <property name="visible">True</property>
-            <property name="label">Custom CSS</property>
+            <property name="label" translatable="yes">Custom CSS</property>
           </object>
         </child>
       </object>
index 73a1125910ec2ee01b387a0dfb843b1ca62e5655..85bf439ead00acdd72236d14c0504dfb4803dbe6 100644 (file)
@@ -282,6 +282,18 @@ modules/input/imti-er.c
 modules/input/imti-et.c
 modules/input/imviqr.c
 modules/input/imxim.c
+modules/inspector/classes-list.c
+modules/inspector/css-editor.c
+modules/inspector/inspect-button.c
+modules/inspector/window.c
+modules/inspector/button-path.ui.h
+modules/inspector/classes-list.ui.h
+modules/inspector/css-editor.ui.h
+modules/inspector/object-hierarchy.ui.h
+modules/inspector/prop-list.ui.h
+modules/inspector/themes.ui.h
+modules/inspector/widget-tree.ui.h
+modules/inspector/window.ui.h
 modules/printbackends/cloudprint/gtkprintbackendcloudprint.c
 modules/printbackends/cloudprint/gtkprintercloudprint.c
 modules/printbackends/cups/gtkprintbackendcups.c